/**
 * 响应拦截器(一般是约束接口返回的格式的)
 */
import {Inject, Injectable, NestInterceptor} from "@nestjs/common";
import {ExecutionContext,CallHandler} from "@nestjs/common";
import {map, Observable} from "rxjs";
 interface Data<T> {
     data:T
 }
 @Injectable()
export class Response1<T> implements NestInterceptor{
    intercept(context: ExecutionContext, next: CallHandler<any>): Observable<Data<T>> | Promise<Observable<any>> {
        return  next.handle().pipe(map(data => {
            return {
                data,
                status:0,
                message:'牛逼',
                success:true
            }
        }))
    }
}